home *** CD-ROM | disk | FTP | other *** search
/ Clickx 47 / Clickx 47.iso / assets / software / sswitchxp152.exe / source / SpeedswitchXP / speedswitch.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-07-11  |  3.0 KB  |  100 lines

  1. /*
  2.    SpeedswitchXP V1.5
  3.    - Windows XP CPU Frequency Control for Notebooks -
  4.  
  5.    Copyright(c) 2002-2005 Christian Diefer
  6.  
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License version 2 as 
  9.    published by the Free Software Foundation.
  10.    
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.    
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; if not, write to the Free Software
  18.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. #ifndef SPEEDSWITCH_H
  22. #define SPEEDSWITCH_H
  23.  
  24. extern "C" {
  25. #include <windows.h>
  26. #include <winnt.h>
  27. #include <powrprof.h>
  28. };
  29.  
  30. typedef struct _PROCESSOR_POWER_INFORMATION {
  31.   ULONG  Number;
  32.   ULONG  MaxMhz;
  33.   ULONG  CurrentMhz;
  34.   ULONG  MhzLimit;
  35.   ULONG  MaxIdleState;
  36.   ULONG  CurrentIdleState;
  37. } PROCESSOR_POWER_INFORMATION , *PPROCESSOR_POWER_INFORMATION ;
  38.  
  39. extern char* uc2char( char* dest, void* s );   // unicode to ansi (char*)
  40. extern char* char2uc( char* dest, char* s );   // ansi (char*) to unicode
  41.  
  42. int detectProfile();
  43. int createProfile();
  44. void updateStates();
  45. BOOL setState( BOOL ac, BYTE policy );
  46. CString throttleString( UCHAR throttle );         // CPU throttle state to string
  47. CString sysPwrState( SYSTEM_POWER_STATE state );  // power state to string
  48. CString pwrAction( POWER_ACTION action );         // power action to string
  49. DWORD cpuUsageNT();
  50. int writePolicies( BOOL power, BOOL cpu );
  51. BOOL checkProfile( int check );
  52.  
  53. extern int acThrottle;
  54. extern int dcThrottle;
  55. extern POWER_POLICY internalPolicy;           // our own profile policy
  56. extern MACHINE_PROCESSOR_POWER_POLICY mach;   // our own cpu policy
  57.  
  58. #define SystemBasicInformation       0
  59. #define SystemPerformanceInformation 2
  60. #define SystemTimeInformation        3
  61.  
  62. #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + (double)((x).LowPart))
  63.  
  64. typedef struct
  65. {
  66.     DWORD   dwUnknown1;
  67.     ULONG   uKeMaximumIncrement;
  68.     ULONG   uPageSize;
  69.     ULONG   uMmNumberOfPhysicalPages;
  70.     ULONG   uMmLowestPhysicalPage;
  71.     ULONG   uMmHighestPhysicalPage;
  72.     ULONG   uAllocationGranularity;
  73.     PVOID   pLowestUserAddress;
  74.     PVOID   pMmHighestUserAddress;
  75.     ULONG   uKeActiveProcessors;
  76.     BYTE    bKeNumberProcessors;
  77.     BYTE    bUnknown2;
  78.     WORD    wUnknown3;
  79. } SYSTEM_BASIC_INFORMATION;
  80.  
  81. typedef struct
  82. {
  83.     LARGE_INTEGER   liIdleTime;
  84.     DWORD           dwSpare[76];
  85. } SYSTEM_PERFORMANCE_INFORMATION;
  86.  
  87. typedef struct
  88. {
  89.     LARGE_INTEGER liKeBootTime;
  90.     LARGE_INTEGER liKeSystemTime;
  91.     LARGE_INTEGER liExpTimeZoneBias;
  92.     ULONG         uCurrentTimeZoneId;
  93.     DWORD         dwReserved;
  94. } SYSTEM_TIME_INFORMATION;
  95.  
  96. typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG);
  97.  
  98.  
  99. #endif
  100.